home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / sys / RCS / wait.h,v < prev   
Text File  |  1991-10-25  |  6KB  |  252 lines

  1. head     1.8;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.8
  10. date     91.10.25.01.28.44;  author rab;  state Exp;
  11. branches ;
  12. next     1.7;
  13.  
  14. 1.7
  15. date     91.07.25.12.12.59;  author mendel;  state Exp;
  16. branches ;
  17. next     1.6;
  18.  
  19. 1.6
  20. date     90.05.02.17.13.50;  author rab;  state Exp;
  21. branches ;
  22. next     1.5;
  23.  
  24. 1.5
  25. date     89.08.14.14.40.43;  author rab;  state Exp;
  26. branches ;
  27. next     1.4;
  28.  
  29. 1.4
  30. date     89.07.14.09.15.43;  author rab;  state Exp;
  31. branches ;
  32. next     1.3;
  33.  
  34. 1.3
  35. date     88.06.29.14.48.33;  author ouster;  state Exp;
  36. branches ;
  37. next     1.2;
  38.  
  39. 1.2
  40. date     88.06.21.17.36.50;  author ouster;  state Exp;
  41. branches ;
  42. next     1.1;
  43.  
  44. 1.1
  45. date     88.06.21.16.12.58;  author ouster;  state Exp;
  46. branches ;
  47. next     ;
  48.  
  49.  
  50. desc
  51. @@
  52.  
  53.  
  54. 1.8
  55. log
  56. @Added casts for (union wait) in all macros.
  57. @
  58. text
  59. @/*
  60.  * Copyright (c) 1982, 1986 Regents of the University of California.
  61.  * All rights reserved.  The Berkeley software License Agreement
  62.  * specifies the terms and conditions for redistribution.
  63.  *
  64.  *    @@(#)wait.h    7.4 (Berkeley) 1/27/88
  65.  */
  66.  
  67. #ifndef _WAIT
  68. #define _WAIT
  69.  
  70. /*
  71.  * This file holds definitions relevent to the wait system call.
  72.  * Some of the options here are available only through the ``wait3''
  73.  * entry point; the old entry point with one argument has more fixed
  74.  * semantics, never returning status of unstopped children, hanging until
  75.  * a process terminates if any are outstanding, and never returns
  76.  * detailed information about process resource utilization (<vtimes.h>).
  77.  */
  78.  
  79. #include <machine/machparam.h>
  80.  
  81. /*
  82.  * Structure of the information in the first word returned by both
  83.  * wait and wait3.  If w_stopval==WSTOPPED, then the second structure
  84.  * describes the information returned, else the first.  See WUNTRACED below.
  85.  */
  86. union wait    {
  87.     int    w_status;        /* used in syscall */
  88.     /*
  89.      * Terminated process status.
  90.      */
  91.     struct {
  92. #if BYTE_ORDER == LITTLE_ENDIAN
  93.         unsigned int    w_Termsig:7;    /* termination signal */
  94.         unsigned int    w_Coredump:1;    /* core dump indicator */
  95.         unsigned int    w_Retcode:8;    /* exit code if w_termsig==0 */
  96. #endif
  97. #if BYTE_ORDER == BIG_ENDIAN
  98.         unsigned short    w_Filler;    /* upper bits filler */
  99.         unsigned char    w_Retcode;    /* exit code if w_termsig==0 */
  100.         unsigned int    w_Coredump:1;    /* core dump indicator */
  101.         unsigned int    w_Termsig:7;    /* termination signal */
  102. #endif
  103.     } w_T;
  104.     /*
  105.      * Stopped process status.  Returned
  106.      * only for traced children unless requested
  107.      * with the WUNTRACED option bit.
  108.      */
  109.     struct {
  110. #if BYTE_ORDER == LITTLE_ENDIAN
  111.         unsigned int    w_Stopval:8;    /* == W_STOPPED if stopped */
  112.         unsigned int    w_Stopsig:8;    /* signal that stopped us */
  113. #else
  114.         unsigned short    w_Filler;    /* upper bits filler */
  115.         unsigned char    w_Stopsig;    /* signal that stopped us */
  116.         unsigned char    w_Stopval;    /* == W_STOPPED if stopped */
  117. #endif
  118.     } w_S;
  119. };
  120. #define    w_termsig    w_T.w_Termsig
  121. #define w_coredump    w_T.w_Coredump
  122. #define w_retcode    w_T.w_Retcode
  123. #define w_stopval    w_S.w_Stopval
  124. #define w_stopsig    w_S.w_Stopsig
  125.  
  126.  
  127. #define    WSTOPPED    0177    /* value of s.stopval if process is stopped */
  128.  
  129. /*
  130.  * Option bits for the second argument of wait3.  WNOHANG causes the
  131.  * wait to not hang if there are no stopped or terminated processes, rather
  132.  * returning an error indication in this case (pid==0).  WUNTRACED
  133.  * indicates that the caller should receive status about untraced children
  134.  * which stop due to signals.  If children are stopped and a wait without
  135.  * this option is done, it is as though they were still running... nothing
  136.  * about them is returned.
  137.  */
  138. #define WNOHANG        1    /* dont hang in wait */
  139. #define WUNTRACED    2    /* tell about stopped, untraced children */
  140.  
  141. #define WIFSTOPPED(x)    (((union wait *) &(x))->w_stopval == WSTOPPED)
  142. #define WIFSIGNALED(x)    (((union wait *) &(x))->w_stopval != WSTOPPED && \
  143.                          ((union wait *) &(x))->w_termsig != 0)
  144. #define WIFEXITED(x)    (((union wait *) &(x))->w_stopval != WSTOPPED && \
  145.              ((union wait *) &(x))->w_termsig == 0)
  146. #define WEXITSTATUS(x)  (((union wait *) &(x))->w_retcode)
  147. #define WTERMSIG(x)     (((union wait *) &(x))->w_termsig)
  148. #define WSTOPSIG(x)     (((union wait *) &(x))->w_stopsig)
  149.  
  150. extern int wait();
  151. extern int wait3();
  152.  
  153. #endif /* _WAIT */
  154. @
  155.  
  156.  
  157. 1.7
  158. log
  159. @Modified to include machparam.h as <machine/machparam.h>
  160. @
  161. text
  162. @d83 8
  163. a90 3
  164. #define WIFSTOPPED(x)    ((x).w_stopval == WSTOPPED)
  165. #define WIFSIGNALED(x)    ((x).w_stopval != WSTOPPED && (x).w_termsig != 0)
  166. #define WIFEXITED(x)    ((x).w_stopval != WSTOPPED && (x).w_termsig == 0)
  167. @
  168.  
  169.  
  170. 1.6
  171. log
  172. @Added declarations for wait() and wait3().
  173. @
  174. text
  175. @d21 1
  176. a21 1
  177. #include <machparam.h>
  178. @
  179.  
  180.  
  181. 1.5
  182. log
  183. @Fixed declaration of bitfields.
  184. @
  185. text
  186. @d87 3
  187. @
  188.  
  189.  
  190. 1.4
  191. log
  192. @*** empty log message ***
  193. @
  194. text
  195. @d35 3
  196. a37 3
  197.         unsigned short    w_Termsig:7;    /* termination signal */
  198.         unsigned short    w_Coredump:1;    /* core dump indicator */
  199.         unsigned short    w_Retcode:8;    /* exit code if w_termsig==0 */
  200. d42 2
  201. a43 2
  202.         unsigned char    w_Coredump:1;    /* core dump indicator */
  203.         unsigned char    w_Termsig:7;    /* termination signal */
  204. d53 2
  205. a54 2
  206.         unsigned short    w_Stopval:8;    /* == W_STOPPED if stopped */
  207.         unsigned short    w_Stopsig:8;    /* signal that stopped us */
  208. @
  209.  
  210.  
  211. 1.3
  212. log
  213. @Add ifdefs to prevent files from being included multiple times.
  214. @
  215. text
  216. @d34 1
  217. a34 1
  218. #if BYTE_ORDER == LITTLE_ENDIAN 
  219. d39 1
  220. a39 1
  221. #if BYTE_ORDER == BIG_ENDIAN 
  222. d52 1
  223. a52 1
  224. #if BYTE_ORDER == LITTLE_ENDIAN 
  225. d87 1
  226. a87 1
  227. #endif _WAIT
  228. @
  229.  
  230.  
  231. 1.2
  232. log
  233. @Pick up machine-dependent stuff from correct place.
  234. @
  235. text
  236. @d9 3
  237. d86 2
  238. @
  239.  
  240.  
  241. 1.1
  242. log
  243. @Initial revision
  244. @
  245. text
  246. @d18 1
  247. a18 3
  248. #ifndef BYTE_ORDER
  249. #include <machine/endian.h>
  250. #endif
  251. @
  252.